Varnish cache with Litespeed web server, vBulletin v4.1.2 Server Port
Testing vBulletin 4.1.2 with Varnish cache as proxy frontend to Litespeed web server v4.0.20 on a VPS server and came across an interesting problem, in admincp editing options i.e. turning on/off forums, it would timeout. If you use Unixy Varnish Cpanel plugin or Varnish cache, please read below.
Looking at Firebug NET monitoring I would see it trying to call forumdomainname:82/options.php?do
This is even with /admincp defined in Varnish vcl to be ignored from cache
if (req.url ~ "/admincp") { return (pass); } |
I found out you need to add the Varnish vcl defined backend port for your server i.e. apache or litespeed to 2 php files in vBulletin v4.1.2.
i.e. Add port 82 for Unixy.net Cpanel Varnish plugin script.
in includes/class_core.php find on line 2003 the server port array
change from
// Get server port $port = intval($_SERVER['SERVER_PORT']); $port = in_array($port, array(80, 443)) ? '' : ':' . $port; |
to
// Get server port $port = intval($_SERVER['SERVER_PORT']); $port = in_array($port, array(80, 82, 443)) ? '' : ':' . $port; |
in install/includes/class_upgrade_install.php find on line 305 and change
from
$port = intval($_SERVER['SERVER_PORT']); $port = in_array($port, array(80, 443)) ? '' : ':' . $port; |
to
$port = intval($_SERVER['SERVER_PORT']); $port = in_array($port, array(80, 82, 443)) ? '' : ':' . $port; |
To date, I only tested Varnish cache as a proxy frontend to Apache or Litespeed with vBulletin 3.8.x series which didn’t have such problems. It’s my first test with vBulletin 4.x series with Varnish cache in front of Litespeed web server so not sure if this applies to Varnish/Apache combination too ? If others have tested Varnish and vBulletin v4.1.2, let me know if you encountered a similar problem.